package me.softwareengineer.guice.rendering.listener;

import java.util.Map;

import me.softwareengineer.guice.rendering.domain.LinkElement;
import me.softwareengineer.guice.rendering.domain.referenece.ResourceReference;

/**
 * Called when before {@link LinkElement}
 * 
 * @author yadtahir
 * 
 *         <pre>
 * This class is thread-safe and immutable.
 * </pre>
 */
public class StartLinkEvent extends EventHasProperties implements
		StartElementEvent {

	/**
	 * A reference to the link target. See
	 * {@link org.xwiki.rendering.listener.reference.ResourceReference} for more
	 * details.
	 */
	private ResourceReference reference;

	/**
	 * If true then the link is defined as a free standing URI directly in the
	 * text.
	 */
	private boolean isFreeStandingURI;

	public StartLinkEvent(ResourceReference reference,
			boolean isFreeStandingURI, Map<String, String> properties) {
		super(properties);
		this.reference = reference;
		this.isFreeStandingURI = isFreeStandingURI;

	}

	/**
	 * 
	 * @return the reference of the link element
	 */
	public ResourceReference getReference() {
		return reference;
	}

	/**
	 * 
	 * @return true if the link is defined as a free standing URI directly in
	 *         the text.
	 */
	public boolean isFreeStandingURI() {
		return isFreeStandingURI;
	}

}
